#!/usr/bin/env bash
# */5 * * * * /data/app/monitor/image.sh >> /data/app/monitor/image.log 2>&1

image_id=$(ps aux | grep -v grep | grep -i java | grep ImageApplication | awk '{print $2}')

if [[ "X${image_id}" != "X" ]] && [[ ${image_id} -gt 0 ]] && kill -0 ${image_id} > /dev/null 2>&1; then
  echo "[$(date +'%Y-%m-%d %H:%M:%S.%N')] ImageApplication running as process ${image_id}.  Stop it first."
  exit 1
fi

curl "http://172.16.18.53:18080/smartop-frontstage/alarm/smsDiexin.action?phones=15882439584,15378179615&msg=$(hostname -i)%20($(hostname))%20ocr识别%20crash!!"

# tencent/ali
#startup_file="/data/flume/flume_tencent/nohup_start.sh /data/flume/flume_ali/nohup_start.sh"
#for f in ${startup_file}; do
 # if [ -f ${f} ]; then
  #  echo "[$(date +'%Y-%m-%d %H:%M:%S.%N')] run startup_file=${f}"
   # sh ${f}
  #fi
#done